<h2>DESCRIPTION</h2>

<em>i.landsat.toar</em> is used to transform the calibrated digital
number of Landsat imagery products to top-of-atmosphere radiance or
top-of-atmosphere reflectance and temperature (band 6 of the sensors
TM and ETM+). Optionally, it can be used to calculate the at-surface
radiance or reflectance with atmospheric correction (DOS method).

<p>
Usually, to do so the production date, the acquisition date, and the
solar elevation are needed. Moreover, for Landsat-7 ETM+ it is also
needed the gain (high or low) of the nine respective bands.

<p>
Optionally (recommended), the data can be read from metadata file
(.met or MTL.txt) for all Landsat MSS, TM, ETM+ and OLI/TIRS. However,
if the solar elevation is given the value of the metadata file is
overwritten. This is necessary when the data in the .met file is
incorrect or not accurate. Also, if acquisition or production dates are
not found in the metadata file then the command line values are used.

<p>
<b>Attention</b>: Any null value or smaller than QCALmin in the input
raster is set to null in the output raster and it is not included in
the equations.

<h2>Uncorrected at-sensor values (method=uncorrected, default)</h2>

The standard geometric and radiometric corrections result in a
calibrated digital number (QCAL = DN) images. To further standardize
the impact of illumination geometry, the QCAL images are first
converted first to at-sensor radiance and then to at-sensor
reflectance. The thermal band is first converted from QCAL to
at-sensor radiance, and then to effective at-sensor temperature in
Kelvin degrees.

<p>
Radiometric calibration converts QCAL to <b>at-sensor radiance</b>, a
radiometric quantity measured in W/(m&sup2; * sr * &micro;m) using the
equations:
<ul>
  <li> gain = (Lmax - Lmin) / (QCALmax - QCALmin)</li>
  <li> bias = Lmin - gain * QCALmin </li>
  <li> radiance = gain * QCAL + bias </li>
</ul>

where, <em>Lmax</em> and <em>Lmin</em> are the calibration constants,
and <em>QCALmax</em> and <em>QCALmin</em> are the highest and the
lowest points of the range of rescaled radiance in QCAL.

<p>
Then, to calculate <b>at-sensor reflectance</b> the equations are:

<ul>
  <li> sun_radiance = [Esun * sin(e)] / (PI * d^2)</li>
  <li> reflectance = radiance / sun_radiance </li>
</ul>

where, <em>d</em> is the earth-sun distance in astronomical
units, <em>e</em> is the solar elevation angle, and <em>Esun</em> is
the mean solar exoatmospheric irradiance in W/(m&sup2; * &micro;m).

<h2>Simplified at-surface values (method=dos[1-4])</h2>

Atmospheric correction and reflectance calibration remove the path
radiance, i.e. the stray light from the atmosphere, and the spectral
effect of solar illumination. To output these simple <b>at-surface
radiance</b> and <b>at-surface reflectance</b>, the equations are (not
for thermal bands):

<ul>
  <li> sun_radiance = TAUv * [Esun * sin(e) * TAUz + Esky] / (PI * d^2) </li>
  <li> radiance_path = radiance_dark - percent * sun_radiance </li>
  <li> radiance = (at-sensor_radiance - radiance_path) </li>
  <li> reflectance = radiance / sun_radiance </li>
</ul>

where, <em>percent</em> is a value between 0.0 and 1.0 (usually
0.01), <em>Esky</em> is the diffuse sky irradiance, <em>TAUz</em> is
the atmospheric transmittance along the path from the sun to the
ground surface, and <em>TAUv</em> is the atmospheric transmittance
along the path from the ground surface to the
sensor. <em>radiance_dark</em> is the at-sensor radiance calculated
from the darkest object, i.e. DN with a least 'dark_parameter'
(usually 1000) pixels for the entire image.

The values are,

<ul>
  <li>DOS1: TAUv = 1.0, TAUz = 1.0 and Esky = 0.0</li>
  <li>DOS2: TAUv = 1.0, Esky = 0.0, and TAUz = sin(e) for all bands
    with maximum wave length less than 1. (i.e. bands 4-6 MSS, 1-4 TM,
    and 1-4 ETM+) other bands TAUz = 1.0</li>
  <li>DOS3: TAUv = exp[-t/cos(sat_zenith)],
    TAUz = exp[-t/sin(e)], Esky = rayleigh</li>
  <li>DOS4: TAUv = exp[-t/cos(sat_zenith)],
    TAUz = exp[-t/sin(e)], Esky = PI * radiance_dark </li>
</ul>

<b>Attention</b>: Output radiance remain untouched (i.e. no set to 0.0
when it is negative) then they are possible negative values. However,
output reflectance is set to 0.0 when is obtained a negative value.

<h2>NOTES</h2>

The output raster cell values can be rescaled with the <b>scale</b>
parameter (e.g., with 100 in case of using reflectance output
in <em>i.gensigset</em>).

<h3>On Landsat-8 metadata file </h3>

NASA reports a structure of the L1G Metadata file 
(<a href="http://landsat.usgs.gov/documents/LDCM-DFCB-004.pdf">LDCM-DFCB-004.pdf</a>) 
for Landsat Data Continuity Mission (i.e. Landsat-8).

<p>
NASA retains in MIN_MAX_RADIANCE group the necessary information 
to transform Digital Numbers (DN) in radiance values. Then, 
<em>i.landsat.toar</em> replaces the possible standard values with the 
metadata values. The results match with the values reported by the 
metada file in RADIOMETRIC_RESCALING group.

<p>
Also, NASA reports the same values of reflectance for all bands 
in max-min values and in gain-bias values. This is strange that all 
bands have the same range of reflectance. Also, they wrote in the 
web page as to calculate reflectance directly from DN, first with 
RADIOMETRIC_RESCALING values and second divided by sin(sun_elevation).

<p>
This is a simple rescaling 

<ul>
  <li> reflectance = radiance / sun_radiance = (DN * RADIANCE_MULT + RADIANCE_ADD) / sun_radiance</li>
  <li> now reflectance = DN * REFLECTANCE_MULT + REFLECTANCE_ADD </li>
  <li> then REFLECTANCE_MULT = RADIANCE_MULT / sun_radiance </li>
  <li> and REFLECTANCE_ADD = RADIANCE_ADD / sun_radiance </li>
</ul>

<p>
The problem arises when we need ESUN values (not provided) to 
compute sun_radiance and DOS. We assume that REFLECTANCE_MAXIMUM 
corresponds to the RADIANCE_MAXIMUM, then

<ul>
  <li> REFLECTANCE_MAXIMUM / sin(e) = RADIANCE_MAXIMUM / sun_radiance</li>
  <li> Esun = (PI * d^2) * RADIANCE_MAXIMUM / REFLECTANCE_MAXIMUM </li>
</ul>

where <em>d</em> is the earth-sun distance provided by metadata file 
or computed inside the program.

<p>
The <em>i.landsat.toar</em> reverts back the NASA rescaling to continue 
using Lmax, Lmin, and Esun values to compute the constant to convert 
DN to radiance and radiance to reflectance with the "traditional" 
equations and simple atmospheric corrections.

<b>Attention</b>: When MAXIMUM values are not provided,
<em>i.landsat.toar</em> tries to calculate Lmax, Lmin, and Esun from 
RADIOMETRIC_RESCALING (in tests the results were the same).

<h3>Calibration constants</h3>
In verbose mode (flag <b>--verbose</b>), the program write basic
satellite data and the parameters used in the transformations.

<p>
Production date is not an exact value but it is necessary to apply
correct calibration constants, which were changed in the dates:
<ul>
  <li>Landsat-1 MSS: never </li>
  <li>Landsat-2 MSS: July 16, 1975</li>
  <li>Landsat-3 MSS: June 1, 1978</li>
  <li>Landsat-4 MSS: August 26, 1982 and April 1, 1983</li>
  <li>Landsat-4 TM:  August 1, 1983 and January 15, 1984</li>
  <li>Landsat-5 MSS: April 6, 1984 and November 9, 1984</li>
  <li>Landsat-5 TM:  May 4, 2003 and April, 2 2007</li>
  <li>Landsat-7 ETM+: July 1, 2000</li>
  <li>Landsat-8 OLI/TIRS: launched in 2013</li>
</ul>

<h2>EXAMPLES</h2>

<h3>Metadata file examples</h3>

Transform digital numbers of Landsat-7 ETM+ in band rasters 203_30.1,
203_30.2 [...] to uncorrected at-sensor reflectance in output files
203_30.1_toar, 203_30.2_toar [...] and at-sensor temperature in output
files 293_39.61_toar and 293_39.62_toar:

<div class="code"><pre>
i.landsat.toar input=203_30. output=_toar \
  metfile=p203r030_7x20010620.met
</pre></div>

or

<div class="code"><pre>
i.landsat.toar input=L5121060_06020060714. \
  output=L5121060_06020060714_toar \
  metfile=L5121060_06020060714_MTL.txt
</pre></div>

or

<div class="code"><pre>
i.landsat.toar input=LC80160352013134LGN03_B output=toar \
  metfile=LC80160352013134LGN03_MTL.txt sensor=oli8 date=2013-05-14
</pre></div>

<h3>DOS1 example</h3>

DN to reflectance using DOS1:

<div class="code"><pre>
# rename channels or make a copy to match i.landsat.toar's input scheme:
g.copy raster=lsat7_2002_10,lsat7_2002.1
g.copy raster=lsat7_2002_20,lsat7_2002.2
g.copy raster=lsat7_2002_30,lsat7_2002.3
g.copy raster=lsat7_2002_40,lsat7_2002.4
g.copy raster=lsat7_2002_50,lsat7_2002.5
g.copy raster=lsat7_2002_61,lsat7_2002.61
g.copy raster=lsat7_2002_62,lsat7_2002.62
g.copy raster=lsat7_2002_70,lsat7_2002.7
g.copy raster=lsat7_2002_80,lsat7_2002.8
</pre></div>

Calculation of reflectance values from DN using DOS1 (metadata obtained
from <a href="http://www.grassbook.org/wp-content/uploads/ncexternal/landsat/2002/p016r035_7x20020524.met.gz">p016r035_7x20020524.met.gz</a>):

<div class="code"><pre>
i.landsat.toar input=lsat7_2002. output=lsat7_2002_toar. sensor=tm7 \
  method=dos1 date=2002-05-24 sun_elevation=64.7730999 \
  product_date=2004-02-12 gain=HHHLHLHHL
</pre></div>

The resulting Landsat channels are named <tt>lsat7_2002_toar.1 .. lsat7_2002_toar.8</tt>.


<h2>REFERENCES</h2>

<ul>
  <li>Chander G., B.L. Markham and D.L. Helder, 2009: Remote Sensing of
    Environment, vol. 113</li>

  <li>Chander G.H. and B. Markham, 2003: IEEE Transactions On Geoscience And
    Remote Sensing, vol. 41, no. 11.</li>

  <li>Chavez P.S., jr. 1996: Image-based atmospheric corrections -
    Revisited and Improved. Photogrammetric Engineering and Remote
    Sensing 62(9): 1025-1036.</li>

  <li>Huang et al: At-Satellite Reflectance, 2002: A First Order Normalization
    Of Landsat 7 ETM+ Images.</li>

  <li>R. Irish: <a href="http://landsathandbook.gsfc.nasa.gov/orbit_coverage/">Landsat
      7. Science Data Users Handbook</a>. February 17, 2007; 15 May 2011.</li>

  <li>Markham B.L. and J.L. Barker, 1986: Landsat MSS and TM Post-Calibration
    Dynamic Ranges, Exoatmospheric Reflectances and At-Satellite
    Temperatures. EOSAT Landsat Technical Notes, No. 1.</li>

  <li>Moran M.S., R.D. Jackson, P.N. Slater and P.M. Teillet, 1992: Remote
    Sensing of Environment, vol. 41.</li>

  <li>Song et al, 2001: Classification and Change Detection Using Landsat TM
    Data, When and How to Correct Atmospheric Effects? Remote Sensing
    of Environment, vol. 75.</li>
</ul>

<h2>SEE ALSO</h2>

<em>
  <a href="i.atcorr.html">i.atcorr</a>,
  <a href="i.colors.enhance.html">i.colors.enhance</a>,
  <a href="r.mapcalc.html">r.mapcalc</a>,
  <a href="r.in.gdal.html">r.in.gdal</a>
</em>
<p>
<a href="https://lta.cr.usgs.gov/DD/landsat_dictionary.html">Landsat Data Dictionary</a> by USGS

<h2>AUTHOR</h2>

E. Jorge Tizado  (ej.tizado unileon es), Dept. Biodiversity and Environmental Management,
University of Le&oacute;n, Spain

<!--
<p>
<i>Last changed: $Date$</i>
-->
